<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./font/iconfont.css">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        header {
            font-size: 20px;
            color: white;
            align-items: center;
            height: 50px;
            background-color: rgb(67, 165, 222);
            display: flex;
            justify-content: space-between;
            padding: 0 10px;
        }

        header .iconfont {
            margin: 0 10px;
        }

        main {
            display: flex;
        }

        main .left {
            padding: 40px auto;
            font-size: 16px;
            color: rgb(232, 232, 232);
            text-align: center;
            min-width: 150px;
            min-height: 700px;
            line-height:60px;
            background-color: rgb(67, 165, 222);
        }

        main .left div.active {
            background-color: rgb(105, 141, 176);
        }

        main .left .iconfont {
            margin-right: 10px;
        }

        main .right {
            flex: 1;
            padding: 20px;
        }

        main .right .shang input {
            height: 30px;
            width: 180px;
            border-radius: 15px;
            outline: none;
            border: 1px solid rgb(202, 202, 202);
            padding-left: 20px;
        }

        main .right .shang button {
            margin-left: 10px;
            width: 70px;
            background-color: rgb(118, 194, 118);
            color: white;
            outline: none;
            height: 30px;
            border-radius: 10px;
            border: 1px solid transparent;
        }

        main .right button {
            margin: 10px;
            width: 90px;
            background-color: rgb(118, 194, 118);
            color: white;
            outline: none;
            height: 30px;
            border-radius: 5px;
            border: 1px solid transparent;
        }

        main .right table {
            /* 想要给表格tr添加边框线，需要给table写如下代码，才能让边框显示出来 */
            border-collapse: collapse;
            margin: 20px 0;
            width: 100%;
            min-width: 700px;
            text-align: center;
            line-height: 40px;
        }

        main .right table  tbody tr {
            border-top: 1px solid rgb(221, 221, 221);
            min-width: 600px;
        }
        main .right table  tbody tr .gc{
            background-color: rgb(118, 194, 118);
            display: inline-block;
            height: 30px;
            width: 60px;
            color: white;
            outline: none;
            border-radius: 8px;
            text-align: center;
            line-height: 30px;
        }
        main .right table tr td:first-child,main .right table tr th:first-child{
            text-align: left;
        }
        main .right table tr td .iconfont {
            padding-right: 10px;
        }
        main .right .yeniu{
            margin: 0 auto;
            width: 200px;
        }
        main .right .yeniu button {
            width: 80px;
            height: 30px;
        }
    </style>
</head>

<body>
    <header>
        <span>9644云专题</span>
        <div><span class="iconfont">&#xe649;</span>猫狸（9644云专题）</div>
    </header>
    <main>
        <div class="left">
            <div><span class="iconfont">&#xe61e;</span>首页</div>
            <div><span class="iconfont">&#xe786;</span>专题</div>
            <div class="active"><span class="iconfont">&#xe649;</span>用户</div>
            <div><span class="iconfont">&#xe617;</span>设置</div>
            <div><span class="iconfont">&#xe609;</span>日志</div>
        </div>
        <div class="right">
            <div class="shang">
                <input type="text" placeholder="搜索用户">
                <button>搜索</button>
            </div>
            <button class="zhong">+ 添加用户</button>
            <table>
                <thead>
                    <tr>
                        <th>邮箱（账户）</th>
                        <th>姓名</th>
                        <th>电话</th>
                        <th>所属组</th>
                        <th>管理员</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- <tr>
                        <td>邮箱（账户）</td>
                        <td>姓名</td>
                        <td>电话</td>
                        <td>所属组</td>
                        <td>管理员</td>
                        <td>状态</td>
                        <td><span class="iconfont">&#xe616;</span><span class="iconfont" style=" padding-right: 0;">&#xe627;</span></td>
                    </tr> -->
                </tbody>
            </table>
            <div class="yeniu">
                <button>上一页</button><button>下一页</button>
            </div>
        </div>
    </main>
</body>

</html>
<script src="./axios.min.js"></script>
<!-- <script src="./mock.js"></script> -->
<!-- <script src="./mock-data.js"></script> -->
<!-- <script src="./promise-ajax.js"></script> -->
<script>


    function render(data) {
        console.log(data);
        var str= ''
        var str = data.map((item, index) => {
            return `
            <tr>
                <td>${item.email}</td>
                <td>${item.name}</td>
                <td>${item.phone}</td>
                <td>${item.ingroup}</td>
                <td>${item.admin}</td>
                <td class ="gc">${item.status}</td>
                <td><span class="iconfont">&#xe616;</span><span class="iconfont" style=" padding-right: 0;">&#xe627;</span></td>
            </tr>
            `
        }).join('')
        document.querySelector('tbody').innerHTML = str
    }


    // axios从axios.min.js文件暴露，用来发送ajax请求
    axios.get('/user/list',{params:{page:1,count:10}}).then((res)=>{
        console.log(res.data);
    }) 
    axios.post('/user/login',{phone:'13345678833',pass:'1234'}).then((res)=>{
        console.log(res.data);
    })  

</script>


